package net.jjjshop.common.service.lbt.impl;

import cn.hutool.core.collection.CollUtil;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import net.jjjshop.common.entity.lbt.BusinessOrderRequest;
import net.jjjshop.common.entity.lbt.JybTradeOrderEntity;
import net.jjjshop.common.mapper.lbt.TradeMapper;
import net.jjjshop.common.service.lbt.TradeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Map;

@Service
public class TradeServiceImpl extends ServiceImpl<TradeMapper, BusinessOrderRequest> implements TradeService {

    @Autowired
    private TradeMapper tradeDao;

    @Override
    public IPage<BusinessOrderRequest> getSaleList(BusinessOrderRequest request, Integer page, Integer limit) {
        Page<BusinessOrderRequest> pages = new Page<>(page,limit);
        Map<String, Object> map = CollUtil.newHashMap();
        if (request.getStatus() != null) {
            map.put("status", request.getStatus());
        }
        if (request.getType() != null) {
            map.put("type", request.getType());
        }


        return tradeDao.getSaleList(pages,map);
    }
}
